package com.yunhai.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunhai.system.mapper.BannerMapper;
import com.yunhai.system.domain.Banner;
import com.yunhai.system.service.BannerService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * banner图(Banner)表服务实现类
 *
 * @author jxj
 * @since 2021-01-09 14:17:38
 */
@Service("bannerService")
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements BannerService {
    @Override
    public List<Banner> queryList(Banner banner) {
        LambdaQueryWrapper<Banner> lqw = Wrappers.lambdaQuery();
        if (null != banner.getPosition()) {
            lqw.eq(Banner::getPosition, banner.getPosition());
        }
        if (null != banner.getLanguage()) {
            lqw.eq(Banner::getLanguage ,banner.getLanguage());
        }
        lqw.orderByAsc(Banner::getSortNum);

        return this.list(lqw);
    }
}